#include "cronometer.h"



// Visual C++ does not have <sys\times.h>, only gcc compilers

// Micro$oft ...

#ifndef _MSC_VER



VOID Cronometer::startCronometer(){

  startTime = getTime();

}



VOID Cronometer::finishCronometer(){

  finishTime = getTime();

}



DOUBLE	Cronometer::getElapsedTime(){	

  return (DOUBLE)(finishTime - startTime)/((DOUBLE)CLK_TCK);

}



UINT Cronometer::getTime(){

  struct tms time;

  times(&time);

  return((UINT)(time.tms_utime + time.tms_stime));

}



#else



//  OLD routine *****************************



VOID Cronometer::startCronometer(){

  startTime = clock();

}



VOID Cronometer::finishCronometer(){

  finishTime = clock();

}



DOUBLE	Cronometer::getElapsedTime(){

  return (double)((finishTime - startTime)/((DOUBLE)CLOCKS_PER_SEC));
  //return (double)(finishTime - startTime);

}

#endif

